//package cn.linkpower.config;
//
//import java.util.Locale;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.util.StringUtils;
//import org.springframework.web.servlet.LocaleResolver;
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//
//@Configuration
//public class LocaleResolverConfig implements WebMvcConfigurer  {
//	private static Logger log = LoggerFactory.getLogger(LocaleResolverConfig.class);
//	
////	@Bean
////    public WebMvcConfigurer webMvcConfigurer() {
////		log.info("WebMvcConfigurer success");
////        return new WebMvcConfigurerConfig();
////    }
//	
//	@Bean
//    public LocaleResolver localeResolver() {
//        log.info("LocaleResolver success");
//        return new LanguageLocaleResolverConfig();
//    }
//	
//	protected static class LanguageLocaleResolverConfig implements LocaleResolver{
//		
//		
//		private static final String PATH_PARAMETER_SPLIT = "_";
//
//		@Override
//		public Locale resolveLocale(HttpServletRequest request) {
//			//获取请求来的语言方式
//			String language = request.getParameter("language");
//			log.info("language:{}",language);
//			//获取请求头默认的local对象
//			Locale locale = request.getLocale();
//			log.info("Add default.");
//			if(!StringUtils.isEmpty(language)) {
//				//按照指定的正则表达式，解析出相关的数据信息
//				String[] split = language.split(PATH_PARAMETER_SPLIT);
//				//解析出数据后，修改local对象
//				locale = new Locale(split[0], split[1]);
//				log.info("Add custom.");
//			}
//			return locale;
//		}
//
//		@Override
//		public void setLocale(HttpServletRequest request, HttpServletResponse response, Locale locale) {
//			// TODO Auto-generated method stub
//			
//		}
//		
//	}
//}


